package com.woniuxy.ticketauth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.ticketauth.entity.Perm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PermMapper extends BaseMapper<Perm> {
    @Select("SELECT p.id,p.name,p.code,p.link,p.parent_id,p.type,p.`status` from ticket_manager_role mr,ticket_role_perm rp,ticket_perm p WHERE \n" +
            "mr.rid = rp.rid and rp.pid = p.id and mr.mid = #{id} and p.type = 'm';")
    List<Perm> getPermsById(int id);

    @Select("SELECT p.id,p.name,p.code,p.link,p.parent_id,p.type,p.`status` from ticket_manager_role mr,ticket_role_perm rp,ticket_perm p WHERE \n" +
            "mr.rid = rp.rid and rp.pid = p.id and mr.mid = #{id} and p.type = 'a';")
    List<Perm> getMenusById(int id);
}
